package com.weixin.program.delay;

import com.weixin.program.task.Task;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.DelayQueue;

@Data
@Slf4j
public class DelayQueueTask {

    private static DelayQueue<Task> delayQueue = new DelayQueue<>();

    private static DelayQueue<Task> noticeDelayQueue = new DelayQueue<>();


    public static DelayQueue<Task> getDelayQueue() {
        return delayQueue;
    }

    public static void setDelayQueue(DelayQueue<Task> delayQueue) {
        DelayQueueTask.delayQueue = delayQueue;
    }

    public static DelayQueue<Task> getNoticeDelayQueue() {
        return noticeDelayQueue;
    }

    public static void setNoticeDelayQueue(DelayQueue<Task> noticeDelayQueue) {
        DelayQueueTask.noticeDelayQueue = noticeDelayQueue;
    }

    public static void clearDelayQueue() {
        delayQueue.clear();
        log.info("清空【提醒延迟队列】成功,队列任务数:{}", delayQueue.size());
    }

    public static void clearNoticeDelayQueue() {
        noticeDelayQueue.clear();
        log.info("清空【通知延迟队列】成功,队列任务数:{}", noticeDelayQueue.size());
    }
}
